package com.dtx.module.quickstart;

import com.dtx.dao.SysUserDao;
import com.dtx.entity.SysUser;
import com.dtx.utils.BeeTLUtils;
import com.dtx.utils.JsonUtil;
import org.beetl.sql.core.SQLManager;
import org.beetl.sql.core.SQLReady;

import java.util.List;

public class QuickTest2 {

    public static void main(String[] args) {
        SQLManager sqlManager = BeeTLUtils.getSQLManager();
        SysUser user  = sqlManager.unique(SysUser.class,1);
        System.out.println(user);
        String sql = "select * from sys_user where id=?";
        Integer id  = 1;
        SQLReady sqlReady = new SQLReady(sql,new Object[]{id});
        List<SysUser> userEntities = sqlManager.execute(sqlReady, SysUser.class);
        System.out.println(userEntities);
        SysUserDao mapper = sqlManager.getMapper(SysUserDao.class);
        SysUser userById = mapper.getUserById(11);
        System.out.println(JsonUtil.stringify(userById));
    }
}
